using IronBarCode;
using System.Drawing;
// Reading a barcode is easy with IronBarcode!
var resultFromFile = BarcodeReader.Read(@"file/barcode.png"); // From a file
var resultFromBitMap = BarcodeReader.Read(new Bitmap("barcode.bmp")); // From a bitmap
var resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")); // From an image file
var resultFromPdf = BarcodeReader.ReadPdf(@"file/mydocument.pdf"); // From PDF use ReadPdf
// To configure and fine-tune barcode reading, utilize the BarcodeReaderOptions class
var myOptionsExample = new BarcodeReaderOptions
{
// Choose a reading speed from: Faster, Balanced, Detailed, ExtremeDetail
// There is a tradeoff in performance as more detail is set
Speed = ReadingSpeed.Balanced,
// Reader will stop scanning once a single barcode is found (if set to true)
ExpectMultipleBarcodes = true,
// By default, all barcode formats are scanned for
// Specifying a subset of barcode types to search for would improve performance
ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
// Utilize multiple threads to read barcodes from multiple images in parallel
Multithreaded = true,
// Maximum threads for parallelized barcode reading
// Default is 4
MaxParallelThreads = 2,
// The area of each image frame in which to scan for barcodes
// Specifying a crop area will significantly improve performance and avoid noisy parts of the image
CropArea = new Rectangle(),
// Special setting for Code39 barcodes
// If a Code39 barcode is detected, try to read with both the base and extended ASCII character sets
UseCode39ExtendedMode = true
};
// Read with the options applied
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
// Create a barcode with one line of code
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
// After creating a barcode, we may choose to resize
myBarcode.ResizeTo(400, 100);
// Save our newly-created barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg");
// Get the barcode as an image for further processing
var myBarcodeImage = myBarcode.Image;
Imports IronBarCode
Imports System.Drawing
' Reading a barcode is easy with IronBarcode!
Dim resultFromFile = BarcodeReader.Read("file/barcode.png") ' From a file
Dim resultFromBitMap = BarcodeReader.Read(New Bitmap("barcode.bmp")) ' From a bitmap
Dim resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")) ' From an image file
Dim resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf") ' From PDF use ReadPdf
' To configure and fine-tune barcode reading, utilize the BarcodeReaderOptions class
Dim myOptionsExample As New BarcodeReaderOptions With {
' Choose a reading speed from: Faster, Balanced, Detailed, ExtremeDetail
' There is a tradeoff in performance as more detail is set
.Speed = ReadingSpeed.Balanced,
' Reader will stop scanning once a single barcode is found (if set to true)
.ExpectMultipleBarcodes = True,
' By default, all barcode formats are scanned for
' Specifying a subset of barcode types to search for would improve performance
.ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
' Utilize multiple threads to read barcodes from multiple images in parallel
.Multithreaded = True,
' Maximum threads for parallelized barcode reading
' Default is 4
.MaxParallelThreads = 2,
' The area of each image frame in which to scan for barcodes
' Specifying a crop area will significantly improve performance and avoid noisy parts of the image
.CropArea = New Rectangle(),
' Special setting for Code39 barcodes
' If a Code39 barcode is detected, try to read with both the base and extended ASCII character sets
.UseCode39ExtendedMode = True
}
' Read with the options applied
Dim results = BarcodeReader.Read("barcode.png", myOptionsExample)
' Create a barcode with one line of code
Dim myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
' After creating a barcode, we may choose to resize
myBarcode.ResizeTo(400, 100)
' Save our newly-created barcode as an image
myBarcode.SaveAsImage("EAN8.jpeg")
' Get the barcode as an image for further processing
Dim myBarcodeImage = myBarcode.Image
Install-Package BarCode
바코드 빠른 시작
IronBarCode는 이미지 파일(jpeg, png, 및 jpg)에서 비트맵과 같은 다른 프로그램 형식에 이르기까지 다양한 표준 형식을 지원합니다. 또한 PDF와 같은 외부 형식을 지원하여 IronBarCode가 모든 코드베이스에 원활하게 통합되고 파일 형식 및 변수에 유연성을 제공합니다.
모든 파일 형식에 대한 바코드 리더일 뿐만 아니라, IronBarcode는 EAN8, Code128 및 Code39와 같은 모든 표준 인코딩 및 형식을 지원하는 바코드 생성기로도 사용됩니다. 바코드 생성기 설정은 단 두 줄의 코드만 필요합니다. 낮은 진입 장벽과 개발자에게 제공되는 다양한 사용자 지정 옵션으로, IronBarCode는 바코드와 관련된 모든 상황에서 최고의 선택입니다.
`var myOptionsExample = new BarcodeReaderOptions { /* Options */ };`
바코드 작성기
먼저 IronBarCode 및 System.Drawing와 같은 필요한 라이브러리를 가져오고, BarcodeWriter를 인스턴스화하여 12345의 문자열 값과 EAN8의 형식으로 바코드를 생성합니다. 생성된 바코드를 원하는 형식의 이미지로 저장합니다. IronBarCode는 Image 및 Bitmap로 바코드를 생성하는 것을 지원하므로 여러 가지 옵션이 있습니다.
고급 바코드 작성기
위에서 볼 수 있듯이 IronBarCode를 사용하여 바코드를 생성하는 것은 단 두 줄의 코드만을 필요로 하고, 나중에 사용할 수 있도록 파일로 저장합니다. IronBarCode는 상황에 맞추어 바코드를 사용자 정의할 수 있는 다양한 옵션을 개발자에게 제공합니다.
우리는 ResizeTo 메서드를 사용하여 바코드 이미지의 높이와 너비를 전달하여 크기를 조정할 수 있습니다.
바코드 리더
위와 같이, 우리는 먼저 BarcodeReader를 인스턴스화하고, 파일 경로를 Read 메서드에 전달하여 변수를 저장하고 나중에 사용하고 바코드 객체를 조작합니다. PDF와 같은 외부 형식을 읽기 위한 특정 메서드에는 ReadPDF가 포함됩니다; 그러나, 일반 이미지 형식 및 비트맵의 경우 Read을 사용합니다.
BarcodeReaderOptions
IronBarCode는 표준 파일 형식에서 바코드를 스캔할 수 있도록 개발자에게 허용합니다. 그러나 개발자가 특히 바코드 파일 일괄 처리를 프로그래밍 방식으로 읽는 경우 Read 메서드의 동작을 미세 조정하고자 하는 상황이 있습니다. This is where BarcodeReaderOptions comes in. IronBarCode lets you fully customize things such as the speed at which it reads with Speed, whether multiple barcodes are expected in the file with ExpectedMultipleBarcodes, and what kind of barcodes they are with the property ExpectBarcodeTypes. 이것은 개발자들이 여러 이미지에서 바코드를 병렬로 읽기 위해 여러 스레드를 실행할 수 있게 하고, 병렬 읽기 시 사용되는 스레드의 수를 제어할 수 있게 합니다.
이것들은 IronBarCode의 강력함을 보여주는 속성 중 일부에 불과합니다. 전체 목록은 여기에서 문서를 참조하세요.